#include "newuser.h"
#include "ui_newuser.h"
#include <QDebug>
#include "messagepops.h"
#include "signature.h"
#include "mythread.h"
#include "authenticationpopups.h"
#include <QDir>
#include "md5rc4.h"
#include <QFileDialog>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>
#include <QHttpPart>
#include "mainwindow.h"
#include <QPainter>
#include <QGraphicsDropShadowEffect>
#include <QtMath>
#include <QListView>
#include <QStyledItemDelegate>
#include <QPushButton>
#include <QCompleter>
#include <QLineEdit>
#include <QStringListModel>
#include <QGraphicsDropShadowEffect>
#include "hintwindow.h"
#include <QTimer>
#include "messagepops.h"
#include "lcombobox.h"
#include "showsignature.h"
#include "operationdocument.h"
#include "function/function.h"

int ifDigitalVein;//指静脉id(0->未采集成功,1->采集成功)


newUser::newUser(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::newUser)
{
    ui->setupUi(this);

    this->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明
    this->setWindowFlags(Qt::FramelessWindowHint|Qt::Window);   //设置无边框 非顶级窗口
//    this->setWindowFlags(Qt::Window);//将子窗口设置为非顶级窗口

    QWidget *parentWidget=this->parentWidget();
    QPoint globalPos = parentWidget->mapToGlobal(QPoint(0,0));//父窗口绝对坐标
    int x = globalPos.x() + (parentWidget->width() - this->width()) / 2;//x坐标
    int y = globalPos.y() + (parentWidget->height() - this->height()) / 2;//y坐标
    this->move(x, y);//窗口移动

    //设置具体阴影
    QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this);
    shadow_effect->setOffset(0, 0);

    //阴影颜色
    shadow_effect->setColor(QColor(38, 78, 119, 127));
    //阴影半径
    shadow_effect->setBlurRadius(10);
    ui->label_9->setGraphicsEffect(shadow_effect);

    //创建一个文件夹存放用户指静脉信息文件,已经存在返回true
    QDir dir;
    QString myPath=QString("%1%2").arg(MY_PATH).arg("getFingerprints");
    dir.mkpath(myPath);

    initialize();

//    thread=new mythread(this); //初始化线程对象
    aps=new AuthenticationPopups(this);
    aps->setLibel3("");
    aps->hide();

    hintw=new HintWindow(this);
    hintw->setGeometry(80,470,310,90);
    hintw->hide();

    //初始化定时器对象
    hinttime=new QTimer(this);
    //设置定时时间
    hinttime->setInterval(3000);  //3秒
    //关联timeout()信号与自定义的槽函数
    connect(hinttime,SIGNAL(timeout()),this,SLOT(hinttimer()));

    //初始化定时器对象
    deletetime=new QTimer(this);
    //设置定时时间
    deletetime->setInterval(100);  //0.1秒
    //关联timeout()信号与自定义的槽函数
    connect(deletetime,SIGNAL(timeout()),this,SLOT(deletetimer()));

    mps=new MessagePops(this);//初始化提示窗口对象
    mps->hide();
    mps->setGeometry(100,200,270,220);
    connect(mps,SIGNAL(sendMessage(QString)),this,SLOT(receMessage(QString)));

    mps2=new MessagePops(this);//初始化提示窗口对象(不关联信号与槽)
    mps2->hide();
    mps2->setGeometry(100,200,270,220);
}

newUser::~newUser()
{
    delete ui;
}

void newUser::setThread(mythread *thread_,QByteArray bytes_,QStringList accountNumber_, QWidget *widget)
{
    bytes = bytes_;
    thread = thread_;
    connect(thread,SIGNAL(sendThUserData(int,QString)),this,SLOT(receThUserData(int,QString)));
    accountNumbers=accountNumber_;
    qmain = widget;
}

void newUser::hinttimer()
{
    hinttime->stop();//关闭定时器

    hintw->hide();//隐藏指静脉窗口提示
}

void newUser::deletetimer()
{
    deletetime->stop();//关闭定时器

    delete this;
}

//http发送指静脉信息接收槽函数
void newUser::requestFinishedFile(QNetworkReply *reply)
{
//    //1、获取响应状态码
//    QVariant variant = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
//    if (variant.isValid())
//    {
//        qDebug() << variant.toInt();
//    }
//    //2、获取响应头
//    variant = reply->header(QNetworkRequest::ContentTypeHeader);
//    if (variant.isValid())
//        qDebug() << variant.toString();

    //3、获取响应信息
    QByteArray bytes = reply->readAll();

    qDebug()<<__LINE__<<QString(bytes);

    //把获取的json数据标准化存储
    QJsonParseError myerr;
    QJsonDocument mydoc=QJsonDocument::fromJson(bytes,&myerr);

    //获取最外面的对象
    QJsonObject obj=mydoc.object();

    QString retInfo=obj.value("message").toString();
    if(retInfo == "ok")
    {
        mps->setText("上传成功");
        mps->show();
    }
    else
    {
        mps->setText("上传失败");
        mps->show();
    }

    if(multiPart != nullptr)
    {
        delete multiPart;
        multiPart=nullptr;
    }
    file->close();
//    delete file;
//    file = nullptr;
    file1->close();
//    delete file1;
//    file1 = nullptr;
}

//点击关闭按钮
void newUser::on_pushButton_5_clicked()
{
    if(ifDigitalVein > 0)
    {
        //没有录入该用户，删除指静脉信息
        thread->DeletingUsersOne(ifDigitalVein);
    }

    emit sendUserMan("2");
    deletetime->start();//开启关闭窗口定时器
}

//点击采集指纹按钮
void newUser::on_pushButton_clicked()
{   
    aps->setWindowFlags(Qt::Dialog|Qt::FramelessWindowHint);
    aps->show();


    thread->getWindowOpenBox(2);//该功能为编号2
    thread->getWindowPointer(aps);//穿提示窗口指针
//    thread->setGainUid(uidList);//把UID传过去
    thread->start();  //开启一个线程,线程自动执行run
}

//点击签名按钮
void newUser::on_pushButton_2_clicked()
{
    signature *sn=new signature(this);
    sn->show();
    //关联timeout()信号与自定义的槽函数
    connect(sn,SIGNAL(sendSignaDestroy(QString)),this,SLOT(receSignaDestroy(QString)));

}

//点击打开签名按钮
void newUser::on_pushButton_3_clicked()
{
    //弹出文件对话框
    QString path=QFileDialog::getOpenFileName(this,"选择电子签名",MY_PATH,"Images(*.jpg *.png *.xpm *.bmp)");

    if(path.isEmpty())
    {
        //未选择签名图片

    }
    else
    {
        signaturePath = path;
        ifSignature=1;
        ifInformationIntegrity();

        ui->label_12->setGeometry(130,484,23,22);
        ui->label_12->show();
        ui->pushButton_2->setGeometry(200,480,100,30);
        ui->pushButton_3->setGeometry(320,480,100,30);
    }
}

//自定义完成签名接收槽函数
void newUser::receSignaDestroy(QString data)
{
    if(data == "1:yes")
    {
        signaturePath=QString("%1%2").arg(MY_PATH).arg("签名.jpg");
        ifSignature = 1;//完成签名
        ifInformationIntegrity();
        ui->label_12->setGeometry(130,484,23,22);
        ui->label_12->show();
        ui->pushButton_2->setGeometry(200,480,100,30);
        ui->pushButton_3->setGeometry(320,480,100,30);
    }
}

void newUser::receThUserData(int n, QString data)
{
    if(n == 1)
    {
        QStringList mylist = data.split("@#");
        if(mylist.size() >= 2)
        {
            //指静脉信息采集成功
            setHint(mylist.at(1),1);
            ui->pushButton->setGeometry(200,420,100,30);
            ui->pushButton->setText("重新采集");
            ui->label_11->setGeometry(130,420,60,30);
            ui->label_11->show();
        }
        else
        {
            setHint(data,0);
        }

        ifInformationIntegrity();
    }
    else if(n == 2)
    {
        setHint(data,0);
    }
}

//自定义提示窗口接收槽函数
void newUser::receMessage(QString data)
{
    if(data == "1")
    {
        //删除本机采集的指静脉，从服务器重新获取
        thread->DeletingUsersOne(ifDigitalVein);

        emit sendUserMan("1");
        deletetime->start();//开启关闭窗口定时器
//        delete mps;
//        delete this;
    }

}

void newUser::receLComboBox(int n, QString)
{
    if(n == 1)
    {
        ifInformationIntegrity();
    }
}

void newUser::receLComboBox2(int n, QString)
{
    if(n == 1)
    {
        ifInformationIntegrity();
    }
}

//初始化界面
void newUser::initialize()
{
    //账号只能输入字母和数字
    ui->lineEdit_2->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9]+$")));
    ui->lineEdit_3->setValidator(new QRegExpValidator(QRegExp("[0-9]+$")));

    ui->lineEdit_3->setMaxLength(11);//限制联系方式最多只能输入11位

    //隐藏获取信息后的提示语
    ui->label_11->hide();
    ui->label_12->hide();

    OperationDocument::setqss(ui->lineEdit,":/new/prefix1/resource/myStyleSheet2.qss");
    OperationDocument::setqss(ui->lineEdit_2,":/new/prefix1/resource/myStyleSheet2.qss");
    OperationDocument::setqss(ui->lineEdit_3,":/new/prefix1/resource/myStyleSheet2.qss");


    //设置QComboBox样式
    setcomboBox(ui->comboBox);
    setcomboBox(ui->comboBox_2);

    lComboBox = new LComboBox(this);
    connect(lComboBox,SIGNAL(sendLComboBox(int,QString)),this,SLOT(receLComboBox(int,QString)));
    lComboBox->setGeometry(130,154,150,30);
    QStringList list;
    list<<"男"<<"女";
    lComboBox->setTexe(list);

    lComboBox2 = new LComboBox(this);
    connect(lComboBox2,SIGNAL(sendLComboBox(int,QString)),this,SLOT(receLComboBox2(int,QString)));
    lComboBox2->setGeometry(130,214,150,30);
    QStringList list2;
    list2<<"医生"<<"护士"<<"主任"<<"毒麻管理护士";
    lComboBox2->setTexe(list2);

    QFont font;
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100
    ui->label->setFont(font);
    ui->label_2->setFont(font);
    ui->label_3->setFont(font);
    ui->label_4->setFont(font);
    ui->label_5->setFont(font);
    ui->label_6->setFont(font);
    ui->label_7->setFont(font);
    ui->label_8->setFont(font);
    ui->label_9->setFont(font);
    ui->label_10->setFont(font);
    ui->label_11->setFont(font);
    ui->pushButton->setFont(font);
    ui->lineEdit->setFont(font);
    ui->lineEdit_2->setFont(font);
    ui->lineEdit_3->setFont(font);

    //禁用确定按钮
    ifInformationIntegrity();
}

//设置QComboBox样式
void newUser::setcomboBox(QComboBox *comboBox)
{
    comboBox->setView(new  QListView());

    //设置标题字间距,外阴影
    QFont font;
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100
    QAbstractItemView* view = comboBox->view();
    view->setFont(font);//设置标题字间距
    QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect;
    effect->setBlurRadius(10);//阴影半径
//    effect->setColor(Qt::black);
    effect->setColor(QColor(38, 78, 119, 127));//阴影颜色
    effect->setOffset(0, 0);
    view->setGraphicsEffect(effect);
    view->update();

    static_cast<QMainWindow*>(view->parent())->setStyleSheet("QMainWindow{border:none;background-color: rgb(255, 255, 255);}");

    QMainWindow* container = static_cast<QMainWindow*>(view->parent());
//    container->setAttribute(Qt::WA_TranslucentBackground);
    container->setWindowFlag(Qt::FramelessWindowHint);
    container->setWindowFlag(Qt::NoDropShadowWindowHint);
}

//指静脉提示信息窗口 data->提示语 (0->错误提示图标,1->正确提示图标)
void newUser::setHint(QString data, int n)
{
    hintw->setText(data);
    hintw->setPicture(n);
    hintw->show();

    //开启定时器显示3秒
    hinttime->start();
}

//判断输入用户信息是否完整(-1->不完整,1->完整)
int newUser::ifInformationIntegrity()
{

    //获取QComboBox列表项的当前项的文字
    gender=comboBoxText(lComboBox);//性别
    permission=comboBoxText(lComboBox2);//权限

    gatherName=ui->lineEdit->text();//姓名
    accountNumber=ui->lineEdit_2->text();//账号
    contactInformation=ui->lineEdit_3->text();//联系方式

    if(gender.isEmpty())
    {
        //信息未完善，禁止点击完成按钮
        ui->pushButton_4->setEnabled(false);
        ui->pushButton_4->setStyleSheet("background: #CCCCCC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");
        return -1;
    }
    if(permission.isEmpty())
    {
        //信息未完善，禁止点击完成按钮
        ui->pushButton_4->setEnabled(false);
        ui->pushButton_4->setStyleSheet("background: #CCCCCC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");
        return -1;
    }
    if(gatherName.isEmpty())
    {
        //信息未完善，禁止点击完成按钮
        ui->pushButton_4->setEnabled(false);
        ui->pushButton_4->setStyleSheet("background: #CCCCCC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");
        return -1;
    }
    if(accountNumber.isEmpty())
    {
        ui->pushButton_4->setEnabled(false);
        ui->pushButton_4->setStyleSheet("background: #CCCCCC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");

        return -1;
    }
    if(contactInformation.isEmpty())
    {
        ui->pushButton_4->setEnabled(false);
        ui->pushButton_4->setStyleSheet("background: #CCCCCC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");

        return -1;
    }
    if(ifSignature==0)
    {
        ui->pushButton_4->setEnabled(false);
        ui->pushButton_4->setStyleSheet("background: #CCCCCC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");

        return -1;//未完成签名
    }
    if(ifDigitalVein <= 0)
    {
        ui->pushButton_4->setEnabled(false);
        ui->pushButton_4->setStyleSheet("background: #CCCCCC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");

        return -1;//未完成指静脉
    }

    ui->pushButton_4->setEnabled(true);
    ui->pushButton_4->setStyleSheet("background: #1B89CC;color: rgb(251, 251, 251);font-size: 18px;font-family: Microsoft YaHei;border-bottom-left-radius :16px;border-bottom-right-radius :16px;");

    return 1;
}

//把指静脉信息写入文件中保存
void newUser::WriteDigitalInformation()
{
    Md5Rc4 *mr=new Md5Rc4();//初始化加解密对象
//    mythread *thread=new mythread(this); //初始化线程对象

    char sTemp[10240] = { 0 };

    //设置用户初始信息
    QString sUser1Info=QString("NAME:%1,ADMIN:0,DEPART:0,CARDNO:0,WORKNO:0,PASSWORD:0,UID:%2").arg(gatherName).arg(ifDigitalVein);
    thread->getWriteDevInfo(ifDigitalVein,sUser1Info);
    //获取用户指静脉信息
    thread->getDigitalInformation(ifDigitalVein,sTemp);

    //把两段信息拼接用md5加密
    QString proclaimedWriting=QString("%1%2").arg(sTemp).arg(sUser1Info);//拼接得到明文
    QString md5=mr->md5Encryption(proclaimedWriting);//得到密文

    //把指静脉信息用rc4加密
    unsigned long len = strlen(sTemp);
    qDebug()<<"len="<<len;
    mr->rc4EncryptionDecode(sTemp, len);
    QByteArray array=QByteArray(sTemp,len);

    QFile myfile;
    filePath=QString("%1/getFingerprints/%2_%3.txt").arg(MY_PATH).arg(gatherName).arg(ifDigitalVein);//姓名_uid.txt命名文件
    myfile.setFileName(filePath);

    //把原文件清空覆盖
    myfile.open(QIODevice::ReadWrite|QIODevice::Truncate);
    //把刚才修改好的内容写入到该文件中
    QByteArray ar=array.toHex();
    myfile.write(ar);
    myfile.write("\n");
    myfile.close();

    QString allContent=QString("%1\n%2").arg(sUser1Info).arg(md5);//拼接得到文件的全部内容

    //把原文件追加打开
    myfile.open(QIODevice::ReadWrite|QIODevice::Append);
    //把刚才修改好的内容写入到该文件中
    myfile.write(allContent.toUtf8());
    myfile.close();
}

//发送采集到的指静脉文件
void newUser::sendFingerVeinFile()
{
    //构造manager发送文件
    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    // 连接信号槽
    connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(requestFinishedFile(QNetworkReply *)));

    //添加指静脉文件信息
    QHttpPart imagePart;
    QFileInfo fileinfo(filePath);
    QString filename = fileinfo.fileName();//传输的文件名称
    //此ContentDispositionHeader参数极为重要，如果不对，则发送不成功，name可以随意起名字，但是filename则必须是你要上传的文件名。//姓名@性别@权限@账号@联系方式@id@文件名称
//    imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
    imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"; filename=\"%2\"").arg("f1").arg(filename));
    file = new QFile(filePath);//采集的指静脉信息文件路径
    file->open(QIODevice::ReadOnly);
    //构造multiPart ，用来组装文件数据
    multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
    //依照下面方式将文件的内容附着于multiPart上
    imagePart.setBodyDevice(file);
    file->setParent(multiPart);
    multiPart->append(imagePart);

    //添加签名信息
    QString filePath1=QString("%1签名.jpg").arg(MY_PATH);
    QHttpPart imagePart1;
    QFileInfo fileinfo1(filePath1);
    QString filename1 = fileinfo1.fileName();//传输的文件名称
    //此ContentDispositionHeader参数极为重要，如果不对，则发送不成功，name可以随意起名字，但是filename则必须是你要上传的文件名。//姓名@性别@权限@账号@联系方式@id@文件名称
//    imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
    imagePart1.setHeader(QNetworkRequest::ContentDispositionHeader, QString("form-data; name=\"%1\"; filename=\"%2\"").arg("f1").arg(filename1));
    file1 = new QFile(filePath1);//采集的指静脉信息文件路径
    file1->open(QIODevice::ReadOnly);
    //构造multiPart ，用来组装文件数据
    QHttpMultiPart *multiPart1 = new QHttpMultiPart(QHttpMultiPart::FormDataType);
    //依照下面方式将文件的内容附着于multiPart上
    imagePart1.setBodyDevice(file1);
    file1->setParent(multiPart1);
    multiPart->append(imagePart1);

    //添加用户信息
    QString userinfo=QString("gatherName=%1@gender=%2@permission=%3@accountNumber=%4@contactInformation=%5@UserId=%6@fileName=%7").arg(gatherName).arg(gender).arg(permission).arg(accountNumber).arg(contactInformation).arg(ifDigitalVein).arg(filename);
    QHttpPart textPart;
//    textPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));
    textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"text\""));
    textPart.setBody(userinfo.toUtf8());
    multiPart->append(textPart);
    qDebug()<<"userinfo.toUtf8()="<<QString(userinfo.toUtf8());

    //此处设置上传的url
    QNetworkRequest request(QUrl(URLName_2("upload-vein-file/")));
//    qDebug()<<__LINE__<<"bytes="<<bytes;
    request.setRawHeader("token",bytes);
//    request.setRawHeader("userinfo",userinfo.toUtf8());

    //发送post
    manager->post(request, multiPart);
}

QString newUser::comboBoxText(LComboBox *comboBox)
{
    return comboBox->text();
}

//点击确定按钮
void newUser::on_pushButton_4_clicked()
{
    //检查账号是否重复
    for(int i=0; i<accountNumbers.size(); i++)
    {
        if(accountNumbers.at(i) == accountNumber)
        {
            qDebug()<<__LINE__<<"accountNumber="<<accountNumber;
            mps2->setText("账号已存在");
            mps2->show();
            return;
        }
    }

    if(ui->lineEdit_3->text().size()!=11 || ui->lineEdit_3->text().mid(0,1)!="1")
    {
        mps2->setText("联系方式格式不正确");
        mps2->show();
        return;
    }
    ui->pushButton_4->setEnabled(false);
    mps->setText0("正在上传信息");
    mps->show();

    //把指静脉信息写入文件中保存
    WriteDigitalInformation();

    //把指静脉信息发送给中央系统
    sendFingerVeinFile();

}

//当姓名输入框QLineEdit中的文本改变时，发出此信号，text是新的文本。当通过程序改变文本时，也会触发此信号
void newUser::on_lineEdit_textChanged(const QString &arg1)
{
    if(arg1.isEmpty())
    {
        OperationDocument::setqss(ui->lineEdit,":/new/prefix1/resource/myStyleSheet2.qss");

//        ui->lineEdit->setStyleSheet("border: 1px solid #666666;border-radius: 8px;padding-left:8px;padding-bottom:2px;font-size: 16px;font-family: Microsoft YaHei;color: #999999;");
    }
    else
    {
        OperationDocument::setqss(ui->lineEdit,":/new/prefix1/resource/myStyleSheet.qss");

//        ui->lineEdit->setStyleSheet("border: 1px solid #666666;border-radius: 8px;padding-left:8px;padding-bottom:2px;font-size: 16px;font-family: Microsoft YaHei;color: #333333;");
    }

    ifInformationIntegrity();
}

//当账号输入框QLineEdit中的文本改变时，发出此信号
void newUser::on_lineEdit_2_textChanged(const QString &arg1)
{
    if(arg1.isEmpty())
    {
        OperationDocument::setqss(ui->lineEdit_2,":/new/prefix1/resource/myStyleSheet2.qss");

//        ui->lineEdit_2->setStyleSheet("border: 1px solid #666666;border-radius: 8px;padding-left:8px;padding-bottom:2px;font-size: 16px;font-family: Microsoft YaHei;color: #999999;");
    }
    else
    {
        OperationDocument::setqss(ui->lineEdit_2,":/new/prefix1/resource/myStyleSheet.qss");

//        ui->lineEdit_2->setStyleSheet("border: 1px solid #666666;border-radius: 8px;padding-left:8px;padding-bottom:2px;font-size: 16px;font-family: Microsoft YaHei;color: #333333;");
    }

    ifInformationIntegrity();
}

//当联系方式输入框QLineEdit中的文本改变时，发出此信号
void newUser::on_lineEdit_3_textChanged(const QString &arg1)
{
    if(arg1.isEmpty())
    {
        OperationDocument::setqss(ui->lineEdit_3,":/new/prefix1/resource/myStyleSheet2.qss");

//        ui->lineEdit_3->setStyleSheet("border: 1px solid #666666;border-radius: 8px;padding-left:8px;padding-bottom:2px;font-size: 16px;font-family: Microsoft YaHei;color: #999999;");
    }
    else
    {
        OperationDocument::setqss(ui->lineEdit_3,":/new/prefix1/resource/myStyleSheet.qss");

//        ui->lineEdit_3->setStyleSheet("border: 1px solid #666666;border-radius: 8px;padding-left:8px;padding-bottom:2px;font-size: 16px;font-family: Microsoft YaHei;color: #333333;");
    }

    ifInformationIntegrity();
}

void newUser::on_label_12_clicked()
{
    int x = qmain->x();
    int y = qmain->y();
    int w = qmain->width();
    int h = qmain->height();
    ShowSignature *showsig = new ShowSignature(this);
    showsig->shsize(x, y, w, h);

    qDebug()<<__LINE__<<signaturePath;

    showsig->setPixmap(signaturePath);
    showsig->show();
//    qDebug()<<x<<y<<w<<h;
//    int w = 540;
//    int h = 280;
//    QWidget *signature = new QWidget(this);
//    signature->setWindowFlags(Qt::FramelessWindowHint|Qt::Window);   //设置无边框 非顶级窗口
//    signature->resize(w, h);
//    QPoint globalPos = this->mapToGlobal(QPoint(0,0));//父窗口绝对坐标
//    int x = globalPos.x() + (this->width() - signature->width()) / 2;//x坐标
//    int y = globalPos.y() + (this->height() - signature->height()) / 2;//y坐标
//    signature->move(x, y);//窗口移动

//    QLabel *label = new QLabel(signature);
//    QPixmap *pixmap = new QPixmap(QString("%1%2").arg(MY_PATH).arg("签名.jpg"));
//    pixmap->scaled(label->size());
//    label->setScaledContents(true);
//    label->setPixmap(*pixmap);

//    signature->show();
}
